//随机数组10个求最值

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(){
	srand(time(NULL));
	int array[10] = {0};
	int i = 0;
	for(i=0;i<10;i++){
		array[i] = rand() % 10;
	}
	for(i=0; i<10; i++){
		printf("%d\t",array[i]);
	}
	printf("\n");
	int max =array[0];
	int min =array[0];
	int max_k = 0;
	int min_k = 0;
	for(i=0; i < 10; i++){
		if(max<array[i]){
			max = array[i];
			max_k = i;
		}
		if(min>array[i]){
			min = array[i];
			min_k = i;
		}
	}
	printf("最大值为%d下标为%d\n",max,max_k);
	printf("最小值为%d下标为%d\n",min,min_k);
	return 0;
}
